home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / xmsif15.zip / XMSTEST3.C < prev   
C/C++ Source or Header  |  1991-12-08  |  23KB  |  607 lines

  1. /***************************************************************************
  2. *   xmstest3.c                                                             *
  3. *   MODULE:  XMSIF                                                         *
  4. *   OS:      DOS                                                           *
  5. *   VERSION: 1.0                                                           *
  6. *   DATE:    12/08/91                                                      *
  7. *                                                                          *
  8. *   Copyright (c) 1991 James W. Birdsall. All Rights Reserved.             *
  9. *                                                                          *
  10. *   Requires xmsif.h, testutil.h, and xmstest.h to compile.                *
  11. *   Compiles under Borland C++ 2.0, Turbo C 2.0, or MSC 6.00A.             *
  12. *                                                                          *
  13. *   Regression test and example for XMSIF. See XMSTEST.C for more detail.  *
  14. *                                                                          *
  15. ***************************************************************************/
  16.  
  17. /*
  18. ** system includes <>
  19. */
  20.  
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <string.h>
  24.  
  25.  
  26. /*
  27. ** custom includes ""
  28. */
  29.  
  30. #include "xmsif.h"
  31. #include "xmstest.h"
  32.  
  33. #include "testutil.h"
  34.  
  35.  
  36. /*
  37. ** local #defines
  38. */
  39.  
  40. /*
  41. ** misc: copyright strings, version macros, etc.
  42. */
  43.  
  44. /*
  45. ** typedefs
  46. */
  47.  
  48. /*
  49. ** global variables
  50. */
  51.  
  52. extern int testno;
  53. extern char *gblmsg;
  54.  
  55.  
  56. /*
  57. ** static globals
  58. */
  59.  
  60. /*
  61. ** function prototypes
  62. */
  63.  
  64. /*
  65. ** functions
  66. */
  67.  
  68.  
  69. /***************************************************************************
  70. *   FUNCTION: DO_UMB_TESTS                                                 *
  71. *                                                                          *
  72. *   DESCRIPTION:                                                           *
  73. *                                                                          *
  74. *       Does UMB tests.                                                    *
  75. *                                                                          *
  76. *   ENTRY:                                                                 *
  77. *                                                                          *
  78. *       None.                                                              *
  79. *                                                                          *
  80. *   EXIT:                                                                  *
  81. *                                                                          *
  82. *       Void.                                                              *
  83. *                                                                          *
  84. *   CONSTRAINTS/SIDE EFFECTS:                                              *
  85. *                                                                          *
  86. ***************************************************************************/
  87. void do_UMB_tests(void)
  88. {
  89.     unsigned long largest, allsize;
  90.     unsigned long allsize2;
  91.     unsigned long finalsize;
  92.     void far *handle;
  93.     int status;
  94.     int haveUMB = 0;
  95.     int goodallcore = 1;
  96.  
  97.     gblmsg = "  UMB TESTS";
  98.  
  99.     /* are there UMBs in this system? */
  100.     TESTHEADER();
  101.     printf("Testing UMBcoreleft() and UMBallcoreleft(), determining whether\n");
  102.     printf("there are UMBs in this system.\n");
  103.     largest = UMBcoreleft();
  104.     weirdcodechk("UMBcoreleft()", 0, (void far *) NULL, 0, 0);
  105.     allsize = UMBallcoreleft();
  106.     if (_XMMerror != 0)
  107.     {
  108.         printf("UMBallcoreleft() returned unexpected code 0x%X\n",
  109.                                                      (unsigned int) _XMMerror);
  110.         printf("Another broken system. *sigh*.\n");
  111.         printf("Values returned by UMBallcoreleft() are junk.\n");
  112.         allsize = ((largest == 0L) ? 0L : (384L * 1024L));
  113.         goodallcore = 0;
  114.     }
  115.     if ((largest == 0L) && (allsize == 0L))
  116.     {
  117.         printf("No UMBs found.\n");
  118.     }
  119.     else
  120.     {
  121.         haveUMB = 1;
  122.     }
  123.     if (allsize < largest)
  124.     {
  125.         printf("UMBallcoreleft() reports total size smaller than size of\n");
  126.         printf("largest UMB (from UMBcoreleft()).\n");
  127.         exit(3);
  128.     }
  129.     /* the theoretical max on UMBs is 384K (1024K - 640K) */
  130.     if (((allsize & 0xF) != 0L) || (allsize > (384L * 1024L)))
  131.     {
  132.         printf("UMBallcoreleft() returned weird value %lu\n", allsize);
  133.         exit(3);
  134.     }
  135.     else if (goodallcore != 0)
  136.     {
  137.         printf("UMBallcoreleft() reports %lu bytes in UMBs.\n", allsize);
  138.     }
  139.     if (((largest & 0xF) != 0L) || (largest > (384L * 1024L)))
  140.     {
  141.         printf("UMBcoreleft() returned weird value %lu\n", largest);
  142.         exit(3);
  143.     }
  144.     else
  145.     {
  146.         printf("UMBcoreleft() reports largest UMB is %lu bytes.\n", largest);
  147.     }
  148.     TESTTAILER();
  149.  
  150.     /* try allocating a UMB */
  151.     TESTHEADER();
  152.     printf("Testing UMBalloc().\nShould %s.\n",
  153.                                         ((haveUMB == 0) ? "fail" : "succeed"));
  154.     handle = UMBalloc(((haveUMB == 0) ? (largest) : (largest - 1)), &finalsize);
  155.     weirdcodechk("UMBalloc()", 0, (void far *) NULL, 0, 0);
  156.     if (handle == (void far *) NULL)
  157.     {
  158.         if (haveUMB != 0)
  159.         {
  160.             printf("UMBalloc() returned NULL.\n");
  161.             exit(3);
  162.         }
  163.     }
  164.     else
  165.     {
  166.         if (haveUMB == 0)
  167.         {
  168.             printf("UMBalloc() didn't return NULL.\n");
  169.             exit(3);
  170.         }
  171.     }
  172.     if (finalsize != largest)
  173.     {
  174.         printf("Size rounding didn't happen.\n");
  175.         UMBfree(handle);
  176.         exit(3);
  177.     }
  178.     if (goodallcore != 0)
  179.     {
  180.         allsize2 = UMBallcoreleft();
  181.         weirdcodechk("UMBallcoreleft()", 0, (void far *) NULL, 0, 0);
  182.         if (allsize2 != (allsize - finalsize))
  183.         {
  184.             printf("Total dropped weirdly from %lu to %lu\n", allsize,
  185.                                                                      allsize2);
  186.             UMBfree(handle);
  187.             exit(3);
  188.         }
  189.     }
  190.     TESTTAILER();
  191.  
  192.     /* free it */
  193.     if (haveUMB != 0)
  194.     {
  195.         TESTHEADER();
  196.         printf("Testing UMBfree().\nShould succeed.\n");
  197.         status = UMBfree(handle);
  198.         TRIPLECHECK("UMBfree()", status, 0, (void far *) NULL, 0, 0);
  199.         if (goodallcore != 0)
  200.         {
  201.             allsize2 = UMBallcoreleft();
  202.             weirdcodechk("UMBallcoreleft()", 0, (void far *) NULL, 0, 0);
  203.             if (allsize2 != allsize)
  204.             {
  205.                 printf(
  206.                   "Total before UMBalloc(): %lu  Total after UMBfree(): %lu\n",
  207.                   allsize, allsize2);
  208.                 exit(3);
  209.             }
  210.         }
  211.     }
  212.  
  213.     return;
  214. } /* end of do_UMB_tests() */
  215.  
  216.  
  217. /***************************************************************************
  218. *   FUNCTION: DO_ICOPY_TESTS                                               *
  219. *                                                                          *
  220. *   DESCRIPTION:                                                           *
  221. *                                                                          *
  222. *       Tests interval copy functions (_XMMicopy() and macros).            *
  223. *                                                                          *
  224. *   ENTRY:                                                                 *
  225. *                                                                          *
  226. *       None.                                                              *
  227. *                                                                          *
  228. *   EXIT:                                                                  *
  229. *                                                                          *
  230. *       Void.                                                              *
  231. *                                                                          *
  232. *   CONSTRAINTS/SIDE EFFECTS:                                              *
  233. *                                                                          *
  234. ***************************************************************************/
  235. void do_icopy_tests(void)
  236. {
  237.     int handle;
  238.     unsigned char far *realbuf;
  239.     unsigned char far *guard1, far *guard2, far *guard3;
  240.     unsigned char far *testbuf;
  241.     unsigned char far *testbuf2;
  242.     int status;
  243.     unsigned long start, stop, total;
  244.  
  245.     /* first, allocate some XMS to test with */
  246.     handle = XMMalloc(MINFREE);
  247.     weirdcodechk("XMMalloc", 0, (void far *) NULL, 0, 0);
  248.  
  249.     /* next, allocate a conventional memory buffer */
  250.     realbuf = (unsigned char far *) LMALLOC((MINFREE/1024L) + 3);
  251.     if (realbuf == (unsigned char far *) NULL)
  252.     {
  253.         printf("Can't allocate conventional buffer. Aborting.\n");
  254.         XMMfree(handle);
  255.         exit(3);
  256.     }
  257.  
  258.     /*
  259.     ** Since we can't access EMBs directly, the only way we have of getting
  260.     ** data there is via the copy functions, which we're trying to test. So
  261.     ** the first round of tests will copy data from one half of the
  262.     ** conventional memory to the other, something which we can verify
  263.     ** directly.
  264.     **
  265.     ** Since _XMMcopy is symmetrical, we only need to give one direction
  266.     ** a real workout.
  267.     */
  268.     guard1 = realbuf;
  269.     FMEMSET(guard1, GUARDVAL, 1024);
  270.     testbuf = (unsigned char far *) normptr(guard1 + 1024);
  271.     guard2 = (unsigned char far *) normptr(testbuf + HALFLEN);
  272.     FMEMSET(guard2, GUARDVAL, 1024);
  273.     testbuf2 = (unsigned char far *) normptr(guard2 + 1024);
  274.     guard3 = (unsigned char far *) normptr(testbuf2 + HALFLEN);
  275.     FMEMSET(guard3, GUARDVAL, 1024);
  276.     gblmsg = "  INTERVAL COPY TESTS CONVENTIONAL-CONVENTIONAL";
  277.  
  278.     /* fill first buffer with incrementing words */
  279.     farincwordfill(testbuf, HALFLEN, 0);
  280.     /* fill second buffer with zero */
  281.     FMEMSET(testbuf2, 0, HALFLEN);
  282.  
  283.     /* test one-element copy */
  284.     TESTHEADER();
  285.     printf("_XMMicopy(): one-element copy.\nShould succeed.\n");
  286.     status = _XMMicopy(1L, 50, 1, 0, (unsigned long) testbuf, 0,
  287.                                                   (unsigned long) testbuf2, 1);
  288.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  289.     GUARDCHECK(handle);
  290.     SRCWORDCHECK(testbuf, HALFLEN);
  291.     CPYWORDCHECK(testbuf2, 50);
  292.     ZEROCHECK((testbuf2 + 50), (HALFLEN - 50));
  293.     TESTTAILER();
  294.  
  295.     /* restore destination pattern */
  296.     FMEMSET(testbuf2, 0, HALFLEN);
  297.  
  298.     /* test multi-element copies, even and odd skips */
  299.     TESTHEADER();
  300.     printf("_XMMicopy(): multi-element copies with even and odd skips.\n");
  301.     printf("Should succeed.\n");
  302.     status = _XMMicopy((HALFLEN / 5L), 2, 3, 0, (unsigned long) testbuf, 0,
  303.                                                   (unsigned long) testbuf2, 3);
  304.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  305.     status = _XMMicopy((HALFLEN / 5L), 3, 2, 0, (unsigned long)(testbuf + 2), 0,
  306.                                              (unsigned long)(testbuf2 + 2), 2);
  307.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  308.     GUARDCHECK(handle);
  309.     SRCWORDCHECK(testbuf, HALFLEN);
  310.     CPYWORDCHECK(testbuf2, HALFLEN);
  311.     TESTTAILER();
  312.  
  313.     /* restore destination pattern */
  314.     FMEMSET(testbuf2, 0, HALFLEN);
  315.  
  316.     /* test multi-element copy, zero skip */
  317.     TESTHEADER();
  318.     printf("_XMMicopy(): multi-element copy with zero skip.\n");
  319.     printf("Should succeed.\n");
  320.     status = _XMMicopy((HALFLEN / 1024L), 1024, 0, 0, (unsigned long) testbuf,
  321.                                                0, (unsigned long) testbuf2, 0);
  322.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  323.     GUARDCHECK(handle);
  324.     SRCWORDCHECK(testbuf, HALFLEN);
  325.     CPYWORDCHECK(testbuf2, HALFLEN);
  326.     TESTTAILER();
  327.  
  328.  
  329.     /*
  330.     ** Now, try various copies to EMB, then copy HALFLEN of EMB back to
  331.     ** testbuf2 for checking.
  332.     */
  333.     gblmsg = "  INTERVAL COPY TESTS CONVENTIONAL-EMB";
  334.  
  335.     /* restore destination pattern */
  336.     FMEMSET(testbuf2, 0, HALFLEN);
  337.     status = XMMcopyto(HALFLEN, testbuf2, handle, 0L);
  338.     TRIPLECHECK("XMMcopyto()", status, 0, (void far *) realbuf, handle, 0);
  339.  
  340.     /* test odd and even skips */
  341.     TESTHEADER();
  342.     printf("_XMMicopy(): odd and even skips to zero.\n");
  343.     printf("Should succeed.\n");
  344.     status = _XMMicopy((HALFLEN / 5L), 3, 2, 0, (unsigned long) testbuf,
  345.                                                                 handle, 0L, 0);
  346.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  347.     status = _XMMicopy((HALFLEN / 5L), 2, 3, 0, (unsigned long)(testbuf + 3),
  348.                                                             handle, 24576L, 0);
  349.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  350.     status = _XMMicopy((HALFLEN / 5L), 3, 0, handle, 0L, 0,
  351.                                                   (unsigned long) testbuf2, 2);
  352.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  353.     status = _XMMicopy((HALFLEN / 5L), 2, 0, handle, 24576L, 0,
  354.                                              (unsigned long)(testbuf2 + 3), 3);
  355.     TRIPLECHECK("_XMMicopy()", status, 0, (void far *) realbuf, handle, 0);
  356.     GUARDCHECK(handle);
  357.     SRCWORDCHECK(testbuf, HALFLEN);
  358.     CPYWORDCHECK(testbuf2, HALFLEN);
  359.     TESTTAILER();
  360.  
  361.     /* restore destination pattern */
  362.     FMEMSET(testbuf2, 0, HALFLEN);
  363.     status = XMMcopyto(HALFLEN, testbuf2, handle, 0L);
  364.     TRIPLECHECK("XMMcopyto()", status, 0, (void far *) realbuf, handle, 0);
  365.  
  366.     /* test zero skip */
  367.     TESTHEADER();
  368.     printf("XMMicopyto() and XMMicopyfrom(): zero skip.\nShould succeed.\n");
  369.     status = XMMicopyto((HALFLEN / 5L), 5, 0, testbuf, handle, 0L);
  370.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  371.     status = XMMicopyfrom((HALFLEN / 16L), 16, 0, handle, 0L, testbuf2);
  372.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  373.     GUARDCHECK(handle);
  374.     SRCWORDCHECK(testbuf, HALFLEN);
  375.     CPYWORDCHECK(testbuf2, HALFLEN);
  376.     TESTTAILER();
  377.  
  378.  
  379.     /*
  380.     ** Try some copies with bad offsets, etc., just to make sure _XMMicopy()
  381.     ** is passing along error data from driver OK. _XMMicopy() does no
  382.     ** size checking on its own because it has no idea what the size of
  383.     ** the block is.
  384.     */
  385.     gblmsg = "  INTERVAL COPY TESTS CONVENTIONAL-EMB ERRORS";
  386.  
  387.     /* try copy with bad starting offset */
  388.     TESTHEADER();
  389.     printf("XMMicopyto(): copying to bad offset.\n");
  390.     printf("Should fail.\n");
  391.     status = XMMicopyto(50L, 2, 2, testbuf, handle, (MINFREE + 1L));
  392.     nofailcheck("XMMicopyto()", status, (void far *) realbuf, handle, 0);
  393.     weirdretchk("XMMicopyto()", status, (void far *) realbuf, handle, 0);
  394.     weirdcodechk("XMMicopyto()", XMM_BADDESTOFF, (void far *) realbuf,handle,0);
  395.     SRCWORDCHECK(testbuf, HALFLEN);
  396.     TESTTAILER();
  397.  
  398.     /* try copy with bad ending offset */
  399.     TESTHEADER();
  400.     printf("XMMicopyfrom(): copying block that will run off end.\n");
  401.     status = XMMicopyfrom(50L, 2, 2, handle, (MINFREE - 10L), testbuf2);
  402.     nofailcheck("XMMicopyfrom()", status, (void far *) realbuf, handle, 0);
  403.     weirdretchk("XMMicopyfrom()", status, (void far *) realbuf, handle, 0);
  404.     weirdcodechk("XMMicopyfrom()", XMM_BADSRCOFF,(void far *)realbuf,handle,0);
  405.     TESTTAILER();
  406.  
  407.     /* try copy with source skip too big */
  408.     TESTHEADER();
  409.     printf("_XMMicopy(): source skip too big.\nShould fail.\n");
  410.     status = _XMMicopy(10, 2, 32769U, 0, (unsigned long) testbuf, handle,0L,2);
  411.     nofailcheck("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  412.     weirdretchk("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  413.     weirdcodechk("_XMMicopy()", XMM_SKTOOBIG, (void far *) realbuf, handle, 0);
  414.     SRCWORDCHECK(testbuf, HALFLEN);
  415.     TESTTAILER();
  416.  
  417.     /* try copy with dest skip too big */
  418.     TESTHEADER();
  419.     printf("_XMMicopy(): dest skip too big.\nShould fail.\n");
  420.     status = _XMMicopy(10, 2, 2, 0, (unsigned long) testbuf, handle,0L,32769U);
  421.     nofailcheck("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  422.     weirdretchk("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  423.     weirdcodechk("_XMMicopy()", XMM_SKTOOBIG, (void far *) realbuf, handle, 0);
  424.     SRCWORDCHECK(testbuf, HALFLEN);
  425.     TESTTAILER();
  426.  
  427.     /* try copy with element size too big */
  428.     TESTHEADER();
  429.     printf("_XMMicopy(): element size too big.\nShould fail.\n");
  430.     status = _XMMicopy(10, 16385, 2, 0, (unsigned long) testbuf, handle, 0L, 2);
  431.     nofailcheck("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  432.     weirdretchk("_XMMicopy()", status, (void far *) realbuf, handle, 0);
  433.     weirdcodechk("_XMMicopy()", XMM_ELTOOBIG, (void far *) realbuf, handle, 0);
  434.     SRCWORDCHECK(testbuf, HALFLEN);
  435.     TESTTAILER();
  436.  
  437.  
  438.     /*
  439.     ** Now, let's do some speed tests (and make sure that we can handle
  440.     ** blocks > 64K). We're going to have to write over the middle
  441.     ** guard block to do it, and move the upper guard block.
  442.     */
  443.     gblmsg = "  INTERVAL COPY TESTS CONVENTIONAL-EMB SPEED";
  444.  
  445.     guard2 = (unsigned char far *) normptr(testbuf2 + HALFLEN - 1024);
  446.     FMEMSET(guard2, GUARDVAL, 1024);
  447.     LFMEMSET(testbuf, 0, MINFREE);
  448.     status = XMMcopyto(MINFREE, testbuf, handle, 0L);
  449.     TRIPLECHECK("XMMcopyto()", status, 0, (void far *) realbuf, handle, 0);
  450.     lfarincwordfill(testbuf, MINFREE, 0);
  451.  
  452.     /* first, copy MINFREE bytes by words in two passes */
  453.     TESTHEADER();
  454.     printf("XMMicopyto(): copy %lu bytes by words in two passes.\n", MINFREE);
  455.     printf("Should succeed.\n");
  456.     start = get_tick();
  457.     status = XMMicopyto((MINFREE / 4L), 2, 2, testbuf, handle, 0L);
  458.     stop = get_tick();
  459.     total = stop - start;
  460.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  461.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  462.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  463.     {
  464.         printf("Copy corrupted guard buffers.\n");
  465.         XMMfree(handle);
  466.         LFREE(realbuf);
  467.         exit(3);
  468.     }
  469.     start = get_tick();
  470.     status = XMMicopyto((MINFREE / 4L), 2, 2, (testbuf + 2), handle, 2L);
  471.     stop = get_tick();
  472.     total += (stop - start);
  473.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  474.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  475.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  476.     {
  477.         printf("Copy corrupted guard buffers.\n");
  478.         XMMfree(handle);
  479.         LFREE(realbuf);
  480.         exit(3);
  481.     }
  482.     status = XMMcopyfrom(MINFREE, handle, 0L, testbuf);
  483.     TRIPLECHECK("XMMcopyfrom()", status, 0, (void far *) realbuf, handle, 0);
  484.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  485.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  486.     {
  487.         printf("Copy corrupted guard buffers.\n");
  488.         XMMfree(handle);
  489.         LFREE(realbuf);
  490.         exit(3);
  491.     }
  492.     CPYWORDCHECK(testbuf, MINFREE);
  493.     printf("Succeeded. Took %lu ticks.\n", total);
  494.     TESTTAILER();
  495.  
  496.     /* restore patterns */
  497.     LFMEMSET(testbuf, 0, MINFREE);
  498.     status = XMMcopyto(MINFREE, testbuf, handle, 0L);
  499.     TRIPLECHECK("XMMcopyto()", status, 0, (void far *) realbuf, handle, 0);
  500.     lfarincwordfill(testbuf, MINFREE, 0);
  501.  
  502.     /* copy MINFREE bytes by fives in two passes */
  503.     TESTHEADER();
  504.     printf("XMMicopyto(): copy %lu bytes by fives in two passes.\n", MINFREE);
  505.     printf("Should succeed.\n");
  506.     start = get_tick();
  507.     status = XMMicopyto((MINFREE / 10L), 5, 5, testbuf, handle, 0L);
  508.     stop = get_tick();
  509.     total = stop - start;
  510.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  511.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  512.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  513.     {
  514.         printf("Copy corrupted guard buffers.\n");
  515.         XMMfree(handle);
  516.         LFREE(realbuf);
  517.         exit(3);
  518.     }
  519.     start = get_tick();
  520.     status = XMMicopyto((MINFREE / 10L), 5, 5, (testbuf + 5), handle, 5L);
  521.     stop = get_tick();
  522.     total += (stop - start);
  523.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  524.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  525.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  526.     {
  527.         printf("Copy corrupted guard buffers.\n");
  528.         XMMfree(handle);
  529.         LFREE(realbuf);
  530.         exit(3);
  531.     }
  532.     status = XMMcopyfrom(MINFREE, handle, 0L, testbuf);
  533.     TRIPLECHECK("XMMcopyfrom()", status, 0, (void far *) realbuf, handle, 0);
  534.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  535.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  536.     {
  537.         printf("Copy corrupted guard buffers.\n");
  538.         XMMfree(handle);
  539.         LFREE(realbuf);
  540.         exit(3);
  541.     }
  542.     CPYWORDCHECK(testbuf, MINFREE);
  543.     printf("Succeeded. Took %lu ticks.\n", total);
  544.     TESTTAILER();
  545.  
  546.     /* restore patterns */
  547.     LFMEMSET(testbuf, 0, MINFREE);
  548.     status = XMMcopyto(MINFREE, testbuf, handle, 0L);
  549.     TRIPLECHECK("XMMcopyto()", status, 0, (void far *) realbuf, handle, 0);
  550.     lfarincwordfill(testbuf, MINFREE, 0);
  551.  
  552.     /* copy MINFREE bytes individually in two passes */
  553.     TESTHEADER();
  554.     printf("XMMicopyto(): copy %lu bytes individually in two passes.\n",
  555.                                                                       MINFREE);
  556.     printf("Should succeed.\n");
  557.     start = get_tick();
  558.     status = XMMicopyto((MINFREE / 2L), 1, 1, testbuf, handle, 0L);
  559.     stop = get_tick();
  560.     total = stop - start;
  561.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  562.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  563.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  564.     {
  565.         printf("Copy corrupted guard buffers.\n");
  566.         XMMfree(handle);
  567.         LFREE(realbuf);
  568.         exit(3);
  569.     }
  570.     start = get_tick();
  571.     status = XMMicopyto((MINFREE / 2L), 1, 1, (testbuf + 1), handle, 1L);
  572.     stop = get_tick();
  573.     total += (stop - start);
  574.     TRIPLECHECK("XMMicopyto()", status, 0, (void far *) realbuf, handle, 0);
  575.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  576.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  577.     {
  578.         printf("Copy corrupted guard buffers.\n");
  579.         XMMfree(handle);
  580.         LFREE(realbuf);
  581.         exit(3);
  582.     }
  583.     status = XMMcopyfrom(MINFREE, handle, 0L, testbuf);
  584.     TRIPLECHECK("XMMcopyfrom()", status, 0, (void far *) realbuf, handle, 0);
  585.     if ((farmemcheck(guard1, 1024, GUARDVAL) != 0) ||
  586.         (farmemcheck(guard2, 1024, GUARDVAL) != 0))
  587.     {
  588.         printf("Copy corrupted guard buffers.\n");
  589.         XMMfree(handle);
  590.         LFREE(realbuf);
  591.         exit(3);
  592.     }
  593.     CPYWORDCHECK(testbuf, MINFREE);
  594.     printf("Succeeded. Took %lu ticks.\n", total);
  595.     TESTTAILER();
  596.  
  597.  
  598.     /*
  599.     ** Clean up.
  600.     */
  601.     LFREE(realbuf);
  602.     test_XMMfree(handle);
  603.  
  604.     return;
  605. } /* end of do_icopy_tests() */
  606.  
  607.